﻿using System;
using ALDIOrganizer.Properties;

namespace ALDIOrganizer
{
           

    [Serializable]
    public class StaffRole : IComparable
    {
        public string PositionName
        {
            get
            {
                return position.ToLongString();
            }
        }

        public string PositionExplanation
        {
            get
            {
                return position.Explanation();
            }
        }

        public Position position { get; private set; }

        public StaffRole(Position parPosition)
        {
            position = parPosition;            
        }



        #region IComparable Members

        public int CompareTo(object obj)
        {
            if (!(obj is StaffRole)) return -1;
            var pos2 = obj as StaffRole;
            
            return pos2.position.CompareWith(position);
        }

        #endregion

        public override bool Equals(object obj)
        {
            if (!(obj is StaffRole)) return false;

            var pos2 = obj as StaffRole;
            return pos2.position.Equals(this.position);
        }

        public bool Equals(StaffRole other)
        {
            if (ReferenceEquals(null, other)) return false;
            return ReferenceEquals(this, other) || Equals(other.position, position);
        }

        public override int GetHashCode()
        {
            return position.GetHashCode();
        }
    }        
    
}
